import { UserLayout, BasicLayout, BlankLayout } from '@/layouts'
import {
  CodepenOutlined,
  SettingOutlined,
  AppstoreOutlined,
  BarChartOutlined,
  RocketOutlined,
} from '@ant-design/icons-vue'

const RouteView = {
  name: 'RouteView',
  render: (h) => h('router-view'),
}

export const asyncRouterMap = [
  {
    path: '/',
    name: 'index',
    component: BasicLayout,
    meta: { title: 'menu.home' },
    redirect: '/develop',
    children: [
      {
        path: '/develop',
        name: 'modalDevelop',
        component: () => import('@/views/modal/develop/index'),
        meta: { title: '模型开发', keepAlive: true, icon: CodepenOutlined, permission: ['modal'] },
      },
      {
        path: '/config',
        name: 'modalConfig',
        component: () => import('@/views/modal/config/index'),
        meta: { title: '模型配置', keepAlive: true, icon: SettingOutlined, permission: ['modal'] },
      },
      {
        path: '/feature',
        name: 'modalFeature',
        component: () => import('@/views/modal/feature/index'),
        meta: { title: '特征工程', keepAlive: true, icon: AppstoreOutlined, permission: ['modal'] },
      },
      {
        path: '/assessment',
        name: 'modalAssessment',
        component: () => import('@/views/modal/assessment/index'),
        meta: { title: '模型评估', keepAlive: true, icon: BarChartOutlined, permission: ['modal'] },
      },
      {
        path: '/training',
        name: 'modalTraining',
        component: () => import('@/views/modal/training/index'),
        meta: { title: '推理和训练', keepAlive: true, icon: RocketOutlined, permission: ['modal'] },
      },
    ],
  },
  {
    path: '*',
    redirect: '/404',
    hidden: true,
  },
  {
    path: '/develop/modelDetail/:name',
    hidden: true,
    name: 'modelDetail',
    component: () => import('@/views/modal/develop/detail.vue'),
  },
]

/**
 * 基础路由
 * @type { *[] }
 */
export const constantRouterMap = [
  {
    path: '/user',
    component: UserLayout,
    redirect: '/user/login',
    hidden: true,
    children: [
      {
        path: 'login',
        name: 'login',
        component: () => import(/* webpackChunkName: "user" */ '@/views/user/Login'),
      },
      {
        path: 'register',
        name: 'register',
        component: () => import(/* webpackChunkName: "user" */ '@/views/user/Register'),
      },
      {
        path: 'register-result',
        name: 'registerResult',
        component: () => import(/* webpackChunkName: "user" */ '@/views/user/RegisterResult'),
      },
      {
        path: 'recover',
        name: 'recover',
        component: undefined,
      },
    ],
  },
  {
    path: '/404',
    component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/404'),
  },
]
